package dk.degofedal.airfoil

import scala.Math.pow;

object Tool {
  
  def dist(p0 : (Int, Int), p1 : (Int, Int)) : Double = {
    pow(pow(p1._1 - p0._1, 2.0) + pow(p1._2 - p0._2, 2.0) , 0.5)
  }
  
  def foilLength(corrected : List[(Int, Int)]) : Double = {
    var foilLength = 0.0
    corrected.foldLeft(corrected.head){
      (P0, P1) => {foilLength += Tool.dist(P0,P1); P1}
    }
    foilLength
  }
}